package com.jiangds.open.util;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;

/**
 * {@link TypeRegister} 类型注册器
 *
 * @author jiangliang
 * @since 2021/1/7 16:00
 */
public class TypeRegister {

    private static Set<Class<?>> types = new HashSet<>();

    static {
        types.addAll(Arrays.asList(
                byte.class,
                short.class,
                int.class,
                long.class,
                float.class,
                double.class,
                Byte.class,
                Short.class,
                Integer.class,
                Long.class,
                Float.class,
                Double.class,
                BigDecimal.class,
                String.class,
                Date.class,
                LocalDate.class,
                LocalDateTime.class
        ));
    }

    public static boolean inCollection(Class<?> type) {
        return Collection.class.isAssignableFrom(type);
    }

    public static boolean inCheckType(Class<?> type) {
        return types.contains(type);
    }
}
